package Command.commandInterfacesImpl;

import Command.commandInterfaces.Command;
import Command.commons.interfacesImpl.CeilingFan;

/**
 * @Author: pengzx
 * @Description:
 * @Date: 14:40 2017/9/13
 * @Modified by: 1.0
 */
public class CeilingFanHighCommadn implements Command {
    CeilingFan ceilingFan;
    int PrevSpeed;
    @Override
    public void execute()
    {
        PrevSpeed = ceilingFan.getSpeed();
        ceilingFan.high();
    }

    @Override
    public void undo()
    {
        if (PrevSpeed == CeilingFan.HIGH){
            ceilingFan.high();
        }else if (PrevSpeed == CeilingFan.MEDIUM){
            ceilingFan.medium();
        }else if (PrevSpeed == CeilingFan.LOW){
            ceilingFan.low();
        }else if(PrevSpeed == CeilingFan.OFF){
            ceilingFan.off();
        }
    }

    public CeilingFanHighCommadn(CeilingFan ceilingFan)
    {
        this.ceilingFan = ceilingFan;
    }
}
